package com.match.competition_role.client;

import com.match.commonutils.Result;
import com.match.competition_role.entity.vo.TeaQuery;
import com.match.entity.Vo.UserRoleVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;


/**
 * @author 芊薰
 */
@FeignClient(name = "service-base",fallback = RoleClientImpl.class)
@Component  //将接口交给spring管理
public interface RoleClient {
    @ApiOperation("通过服务调用条件查询教师")
    @PostMapping("/competition_sub/teacher/findTeaByQuery")
    public Result findTeaByQuery(@RequestBody(required = true) TeaQuery teaQuery);

    @ApiOperation("通过服务调用得到教师信息")
    @GetMapping("/competition_sub/teacher/getTeaByNum/{number}")
    public Result getTeaByNum(@PathVariable(value = "number")String number);

    @ApiOperation("通过服务调用更新教师角色")
    @PostMapping("/competition_sub/teacher/updateUserRoleByNumber")
    public Result updateUserRoleByNumber(@RequestBody UserRoleVo userRoleVo);

    @ApiOperation("通过服务调用查询除教师以外的角色")
    @PostMapping ("/competition_sub/teacher/getTeacherRoleNotIn")
    public Result getTeacherRoleNotIn(@RequestBody List<String> list);


    @ApiOperation("通过服务调用查询学生信息")
    //@Cacheable(value = "student",key = "'studentInfo'")
    @GetMapping("/competition_sub/student/findStuByNum/{number}")
    public Result findStuByNum(@ApiParam(value = "学号") @PathVariable String number);
}
